//
//  TopCell.m
//  HWSGW
//
//  Created by avachen on 15/11/5.
//  Copyright © 2015年 luxuanrui. All rights reserved.
//

#import "TopCell.h"
#import "StarView.h"
#import "Movie.h"
#import "UIImageView+WebCache.h"

@implementation TopCell
- (void)setMovie:(Movie *)movie
{
    if (_movie != movie) {
        _movie = movie;
        [self setNeedsLayout];
    }
}
- (void)layoutSubviews
{
    [super layoutSubviews];
    
    NSString *urlString = [self.movie.images objectForKey:@"medium"];
    [_imgView sd_setImageWithURL:[NSURL URLWithString:urlString]];
    
    _titleLabel.text = self.movie.title;
    _titleLabel.backgroundColor = [UIColor colorWithWhite:0 alpha:0.3];
    
    _starView.rating = [self.movie.average floatValue];
    _ratingLabel.text = [NSString stringWithFormat:@"%.1f", [self.movie.average floatValue]];
    
}
@end
